package com.qingcheng.controller.order;


import com.alibaba.dubbo.config.annotation.Reference;
import com.qingcheng.pojo.order.CategoryReport;
import com.qingcheng.service.order.CategoryReportService;
import com.qingcheng.service.order.CreateDateService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/categoryReport")
public class CategoryReportController {

    @Reference
    private CategoryReportService categoryReportService;

    @Reference
    private CreateDateService createDateService;

    //所有分类统计明细
    @RequestMapping("/categoryReport")
    public List<CategoryReport> categoryReport(){
        LocalDate localDate = LocalDate.parse("2019-04-15", DateTimeFormatter.ofPattern("yyyy-MM-dd"));// 得到指定的日期
        return categoryReportService.categoryReport(localDate);

    }

    //一级分类统计明细
    @RequestMapping("/categoryCount")
    public List<Map> categoryCount(String date1,String date2){
        return categoryReportService.categoryCount(date1,date2);
    }



}
